package com.gec.system.util;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class UtilTest {
    @Test
    public  void jwt() {
        // a.生成 jwt token
        String token = JwtHelper.createToken("1", "test");
        System.out.println("加密token = " + token);
        //b. 从 token 中解密获取 userId
        String userId = JwtHelper.getUserId(token);
        System.out.println("解密后userId = " + userId);

        //c.从 token 中解密获取 username
        String username = JwtHelper.getUsername(token);
        System.out.println("解密后username = " + username);
    }
}
